#include "ConfirmPanel.h"
#include "Utilities.h"
#include "PrintUtilities.h"
#include "MenuManager.h"
#include "IPanelDelegate.h"
#include "StlStringAndStreams.h"

#include <cassert>

ConfirmPanel::ConfirmPanel(MenuManager* const i_menuManager)
	: Menu(i_menuManager)
{
}

void ConfirmPanel::Draw() const
{
	STD::cout << Print::Title("CONFIRM PANEL");
	STD::cout << STD::endl << m_sentence << STD::endl << STD::endl;
	STD::cout << "Are you sure?\n\n";
	STD::cout << Print::Options(" Write \"yes\" or \"no\"");
	STD::cout << "Selection: ";	
}

bool ConfirmPanel::Input(const STL::string& i_input)
{
	assert(m_delegate);

	bool goodInput = true;

	if (i_input == "YES" || i_input == "yes")
	{	
		m_delegate->PanelWillClose(true);
		GetMM()->PopMenu();
	}
	else if (i_input == "NO" || i_input == "no")
	{	
		m_delegate->PanelWillClose(false);
		GetMM()->PopMenu();
	}
	else
		goodInput = false;

	return goodInput;
}
